﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Quick.CodeGenerator.Model;

namespace Quick.CodeGenerator.CodeTemplate
{
    /// <summary>
    /// 用户自定义 服务类
    /// </summary>
    public class ICustomDomainTemplate : ITemplate
    {
        /// <summary>
        /// 生成模版
        /// </summary>
        /// <param name="setting"></param>
        /// <returns></returns>
        public string GenerateTemplate(CodeGeneratorSetting setting, string tableName, List<Model.ColumnInfo> columns)
        {
            StringBuilder strBuilder = new StringBuilder();
            strBuilder.AppendLine("/****************");
            strBuilder.AppendLine($"* Creat Date: {DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss")}");
            strBuilder.AppendLine($"* Creator: {setting.Creator}");
            strBuilder.AppendLine("*****************/");
            strBuilder.AppendLine("using System;");
            strBuilder.AppendLine("using System.Collections.Generic;");
            strBuilder.AppendLine("using System.Linq;");
            strBuilder.AppendLine("using System.Text;");
            strBuilder.AppendLine("using System.Threading.Tasks;");
            strBuilder.AppendLine("using Utility.Contracts;");
            strBuilder.AppendLine("using Utility.Data.DbClient;");
            strBuilder.AppendLine($"namespace {setting.Project}.{setting.IDomainNamespace}");
            strBuilder.AppendLine("{");
            strBuilder.AppendLine("    /// <summary>");
            strBuilder.AppendLine("    /// 业务接口操作类：" + tableName);
            strBuilder.AppendLine("    /// 用户自定义部分类");
            strBuilder.AppendLine("    /// </summary>");
            strBuilder.AppendLine($"    public partial interface I{tableName}");
            strBuilder.AppendLine("    {");
            strBuilder.AppendLine("");
            strBuilder.AppendLine("    }");
            strBuilder.AppendLine("}");
            return strBuilder.ToString();
        }
    }
}